package qf.com.servlet;

import qf.com.service.UserService;
import qf.com.service.impl.UserServiceimpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * projectName:kaoshi
 * author:jcl
 * time:2022/5/27 14:13
 * description:
 */
@WebServlet("/userservlet")
public class UserServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String username = request.getParameter("username");
        String password = request.getParameter("password");

        UserService userService = new UserServiceimpl();

        int zhuce = userService.zhuce(username, password);
        if(zhuce!=0){
            request.getRequestDispatcher("long.jsp").forward(request,response);
        }else{
            request.getRequestDispatcher("zhuce.jsp").forward(request,response);
        }


    }



    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doGet(request, response);
    }
}